<template>
  <div class="logo">
    <img src="@/assets/haimianbaobao.jpg">
    <span
      class="title"
      :class="{ 'title-collapsed': collapsed }"
      :style="{ color: titleColor }"
    >{{ defaultSettings.logoTitle }}</span>
  </div>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import defaultSettings from '@/config/defaultSettings.ts'

defineProps({
  collapsed: {
    type: Boolean,
    default: false,
  },
})

// 根据条件计算标题颜色
const titleColor = computed(() => {
  return defaultSettings.defaultSiderTheme === 'light' ? 'rgb(0, 0, 0)' : 'rgb(255, 255, 255)'
})
</script>

<style scoped>
.logo {
  height: 60px;
  margin: 8px;
  margin-bottom: 0px;
  margin-top: 0px;
  /* background: rgb(0, 0, 0); */
  /* border: 1px solid rgb(0, 0, 0); */
  display: flex;
  align-items: center;
  overflow: hidden;

  /* padding: 0 16px; */
  img {
    height: 32px;
    margin-left: 6px;
    margin-right: 8px;
    flex-shrink: 0;
  }

  .title {
    /* color: rgb(0, 0, 0); */
    font-size: 18px;
    font-weight: 600;
    line-height: 50px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    opacity: 1;
    width: auto;
    margin-right: 8px;
    white-space: nowrap;
  }

  .title-collapsed {
    opacity: 0;
    width: 0;
    margin-right: 0;
    transform: scale(0.9);
  }
}
</style>
